home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / GLX / littleRedCap / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.1 KB  |  69 lines

  1. /*
  2.  * Copyright 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include <Xm/Xm.h>
  18. #include <Xm/Form.h>
  19. #include <Xm/PushB.h>
  20. #include <stdio.h>
  21. #include "main.h"
  22.  
  23. static Boolean queryServer (Display * display) 
  24. {
  25.     int major_opcode = 0, first_event = 0, first_error = 0;
  26.     return XQueryExtension(display, "SGI-SUNDRY-NONSTANDARD",
  27.                            &major_opcode, &first_event, &first_error);
  28. }
  29.  
  30. int main (int argc, char ** argv)
  31. {
  32.     XtAppContext app_context;
  33.     Widget toplevel = NULL;
  34.     Widget form = NULL, frame = NULL;
  35.     Display * display = NULL;
  36.     int num_options = 0;
  37.     XrmOptionDescRec * options = getResourceDescriptions(&num_options);
  38.  
  39.     XtToolkitInitialize();
  40.     app_context = XtCreateApplicationContext ();
  41.     setFallbackResources(app_context);
  42.     display = XtOpenDisplay(app_context, NULL, getAppName(), getAppClass(),
  43.                             options, num_options, &argc, argv);
  44.     toplevel = XtVaAppCreateShell(getAppName(), getAppClass(),
  45.                                   applicationShellWidgetClass,
  46.                                   display, 
  47.                                   XtNargc, argc,
  48.                                   XtNargv, argv,
  49.                                   NULL);
  50.  
  51.     if (queryServer(XtDisplay(toplevel)) == True) {
  52.         form = XtVaCreateWidget("form", xmFormWidgetClass, toplevel,
  53.                                 NULL);
  54.     
  55.         frame = setupDesktop(form, app_context);
  56.         setupGLWidget(frame);
  57.         showGLWidget(frame);
  58.     
  59.         XtManageChild(form);
  60.         XtRealizeWidget(toplevel);
  61.         XtAppMainLoop(app_context);
  62.     }
  63.     else {
  64.         fprintf(stderr, "You must run this on an SGI server\n");
  65.         return 1;
  66.     }
  67. }
  68.  
  69.